<template>
	<view>
		<view class="company-main">
			<view class="company-dtl">
				<view class="company-desc">
					<view class="company-logo">
						<image :src="`${host}/${detail.logo}`"></image>
					</view>
					<view class="company-name">
						<view class="t1">{{ detail.title || '-' }}</view>
						<view class="t2">{{ detail.financing || '-' }}<text class="inline-block text-center" style='width:20rpx;'>·</text>{{ detail.scale || 0}}<text
							 class="inline-block text-center" style='width:20rpx;'>·</text>{{ detail.industry || '-'}}</view>
					</view>
				</view>
			</view>
			<view class="top-head-box">
				<view class="desc">
					<text class="iconfontPT iconzuoxishijian1"></text>{{ (detail.s_work_hours || '09:00') + '-' + (detail.e_work_hours || '18:00') }}
				</view>
				<view class="desc">
					<text class="iconfontPT iconxiuxifangshi"></text>{{ detail.rest_time || '-' }}
					<text class="stance"></text>
					<text class="iconfontPT iconjiabanqingkuang"></text>{{ detail.overtime || '-' }}
				</view>
			</view>
			<view class="welfare-main" v-if="detail.welfare.length > 0">
				<scroll-view class="welfare-box" scroll-x="true">
					<view class="welfare-itme" v-for="(item, index) in detail.welfare" :key="index">
						<text :class="[`text-center iconfontPT ${welfareStyle(item)}`]"></text>
						{{ item }}
					</view>
				</scroll-view>
			</view>
		</view>
		<view class="company-detail">
			<view class="tit">公司介绍</view>
			<view class="detail">
				<text>{{detail.introduce}}</text>
			</view>
			<view class="tit" v-if="detail.environmental_img.length > 0">公司照片</view>
			<view class="photo-list" v-if="detail.environmental_img.length > 0">
				<swiper class="photo-box" :indicator-dots="true" :autoplay="true" interval="5000" indicator-color="rgba(255, 255, 255, .3)"
				 indicator-active-color="#fff">
					<block v-for="(item, index) in detail.environmental_img" :key="index">
						<swiper-item class="photo-itme text-center">
							<image mode="aspectFill" :src="`${host}/${item}`" :data-url="item"  @click.stop="$imgPreview(item, index, host, detail.environmental_img)" ></image>
						</swiper-item>
					</block>
				</swiper>
			</view>
			<view class="tit">工商信息</view>
			<view class="business-box">
				<view class="txt">公司全称<text>{{detail.full_name || '-'}}</text></view>
				<view class="txt">公司法人<text>{{detail.legal || '-'}}</text></view>
				<view class="txt">注册时间<text>{{detail.reg_time || '-'}}</text></view>
				<view class="txt">注册资本<text>{{detail.capital || '-'}}</text></view>
			</view>
		</view>
	</view>
</template>

<script>
	import {
		getCompanyInfo
	} from '../../../apis/recruit/index.js'
	export default {
		data() {
			return {
				detail: {},
			}
		},
		onLoad(options) {
			if (options.id) {
				this.id = options.id
				this.initDataFn();
			}
		},
		computed: {
			host() {
				return this.$baseHost.car
			}
		},
		methods: {
			welfareStyle(name) {
				switch (name) {
					case '五险一金':
						return 'iconqianbao';
						break;
					case '带薪年假':
						return 'iconlvyouche';
						break;
					case '年终奖':
						return 'iconnianzhongjiang1';
						break;
					case '补充医疗保险':
						return 'iconbuchongyiliaobaoxian';
						break;
					case '全勤奖':
						return 'iconquanqinjiang';
						break;
					case '员工旅游':
						return 'iconyuangonglvyou';
						break;
					case '交通补助':
						return 'iconjiaotongbutie';
						break;
					case '通讯补贴':
						return 'icontongxunbutie';
						break;
					case '住房补贴':
						return 'iconzhufangbutie';
						break;
					case '节日福利':
						return 'iconjierifuli1';
						break;
					case '包吃':
						return 'iconbaochi1';
						break;
					case '零食下午茶':
						return 'iconxiawucha1';
						break;
					case '定期体检':
						return 'icondingqitijian';
						break;
					case '加班补助':
						return 'iconjiabanbuzhu';
						break;
					case '股票期权':
						return 'icongupiaoqiquan';
						break;
				}
			},
			initDataFn() {
				let _this = this;
				getCompanyInfo({
					company_id: _this.id
				}).then(res => {
					if (res.code == 1) {
						_this.detail = res.data
					}
				})
			},
			//预览图片
			showImgFn(e) {
				let _this = this;
				uni.previewImage({
					current: e.currentTarget.dataset.url,
					urls: _this.detail.environmental_img
				})
			},

		}
	}
</script>

<style lang="less">
	.company-main {
		padding: 0 30rpx;
		color: #333;
		background: #fff;
		overflow: hidden;
	}

	.top-head-box {
		margin-top: 30rpx;
	}

	.desc {
		margin-top: 15rpx;
		font-size: 24rpx;

		.iconfontPT {
			margin-right: 12rpx;
			font-size: 24rpx;
		}

		.stance {
			display: inline-block;
			width: 36rpx;
		}
	}


	.welfare-main {
		white-space: nowrap;
		height: 161rpx;
		overflow: hidden;
		position: relative;
		margin-top: 30rpx;
		box-shadow: 0 -1rpx 0.5rpx -1rpx #CCCCCC;
	}

	.welfare-box {
		height: 161rpx;
		margin-top: 15rpx;
	}

	.welfare-itme {
		margin-top: 15rpx;
		height: 64rpx;
		padding: 18rpx 56rpx;
		box-shadow: 0 3rpx 12rpx 1rpx rgba(153, 153, 153, 0.15);
		display: inline-block;
		vertical-align: top;
		line-height: 64rpx;
		font-size: 30rpx;
		color: #333;
		margin-right: 20rpx;
		margin-left: 10rpx;

		text {
			font-size: 36rpx;
			background: #03B5E2;
			color: #fff;
			border-radius: 50%;
			width: 64rpx;
			height: 64rpx;
			display: inline-block;
			margin-right: 10rpx;
		}
	}

	.company-detail {
		padding: 0 30rpx 60rpx;
		margin-top: 20rpx;
		background: #fff;
		overflow: hidden;

		.tit {
			font-size: 34rpx;
			font-weight: bold;
			padding: 44rpx 0 22rpx;
		}
	}

	.detail {
		font-size: 24rpx;
		line-height: 36rpx;
	}

	.moveAll {
		color: #999;
		display: inline-block;
		margin-left: 15rpx;
	}

	.photo-list {
		white-space: nowrap;
		height: 345rpx;
		border-radius: 20rpx;
		overflow: hidden;

		.photo-itme {
			display: inline-block;
			width: 690rpx;

			image {
				width: 100%;
				height: 100%;
			}
		}
	}

	.photo-box {
		height: 345rpx;
		background: #f8f8f8;
	}

	.company-dtl {
		padding: 30rpx 0;
		box-shadow: 0 1rpx 0.5rpx -1rpx #CCCCCC;
		margin-top: 30rpx;
	}

	.company-logo {
		width: 96rpx;
		height: 96rpx;
		text-align: center;
		line-height: 96rpx;
		font-size: 32rpx;
		font-weight: bold;
		color: #fff;
		background: #E41805;
		border-radius: 10rpx;
		letter-spacing: 3rpx;
		display: inline-block;
		vertical-align: top;

		image {
			width: 96rpx;
			height: 96rpx;
		}
	}

	.company-name {
		font-size: 48rpx;
		color: #333;
		display: inline-block;
		margin-left: 30rpx;
		position: relative;
		width: calc(100% - 126rpx);

		.t2 {
			font-size: 24rpx;
			font-weight: 300;
			margin-top: 8rpx;
		}

	}

	.company-map-box {
		margin-top: 30rpx;
	}

	.business-box {
		font-size: 24rpx;

		.txt {
			margin-top: 20rpx;

			text {
				float: right;
			}
		}
	}
</style>
